package org.jeecg.modules.api.withdraw.mapper;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.api.withdraw.entity.WithdrawRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 提现记录
 * @Author: jeecg-boot
 * @Date:   2024-10-21
 * @Version: V1.0
 */
public interface WithdrawRecordMapper extends BaseMapper<WithdrawRecord> {
    @Update("update fx_withdraw_record set state=#{state},update_time=now() where id=#{id} and state=#{prevState}")
    public int updatState(@Param("id") String id, @Param("prevState")int prevState, @Param("state")int state);

    @Select("select ifnull(sum(money),0) from fx_withdraw_record where DATE_FORMAT(create_time,'%Y-%m')=#{time} and state!=3")
    BigDecimal getSumMoneyAmount(@Param("time") String time);
}
